1 <?php
2 session_start();
3 error_reporting(
0);
4 include(
'includes/config.php');
5 if
(strlen($_SESSION['alogin'])==0)
6     {
7 header(
'location:index.php');
8 }

9 else
{
10 // Code
for change password
11 if
(isset($_POST['submit']))
12     {
13 $password=md5($_POST[
'password']);
14 $newpassword=md5($_POST[
'newpassword']);
15 $username=$_SESSION[
'alogin'];
16     $sql =
"SELECT Password FROM admin WHERE UserName=:username and Password=:password";
17 $query= $dbh -> prepare($sql);
18 $query-> bindParam(
':username', $username, PDO::PARAM_STR);
19 $query-> bindParam(
':password', $password, PDO::PARAM_STR);
20 $query-> execute();
21 $results = $query -> fetchAll(PDO::FETCH_OBJ);

22 if
($query -> rowCount() > 0)
23 {
24 $con=
"update admin set Password=:newpassword where UserName=:username";
25 $chngpwd1 = $dbh->prepare($con);
26 $chngpwd1-> bindParam(
':username', $username, PDO::PARAM_STR);
27 $chngpwd1-> bindParam(
':newpassword', $newpassword, PDO::PARAM_STR);
28 $chngpwd1->execute();
29 $msg=
"Your Password succesfully changed";
30 }

31 else
{
32 $error=
"Your current password is wrong";
33 }
34 }
35 ?>
36
37 <!DOCTYPE HTML>
38 <html>
39 <head>
40 <title>TMS | Admin Change Password</title>
41 <meta name=
"viewport" content="width=device-width, initial-scale=1">
42 <meta http-equiv=
"Content-Type" content="text/html; charset=utf-8" />
43 <script type=
"application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
44
45 <link href=
"css/bootstrap.min.css" rel='stylesheet' type='text/css' />
46 <link href=
"css/style.css" rel='stylesheet' type='text/css' />
47 <link rel=
"stylesheet" href="css/morris.css" type="text/css"/>
48 <link href=
"css/font-awesome.css" rel="stylesheet">
49 <script src=
"js/jquery-2.1.4.min.js"></script>
50 <link href=
'//fonts.googleapis.com/css?family=Roboto:700,500,300,100italic,100,400' rel='stylesheet' type='text/css'/>
51 <link href=
'//fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
52 <link rel=
"stylesheet" href="css/icon-font.min.css" type='text/css' />
53 <script type=
"text/javascript">
54 function valid()
55 {

56 if
(document.chngpwd.newpassword.value!= document.chngpwd.confirmpassword.value)
57 {
58 alert(
"New Password and Confirm Password Field do not match !!");
59 document.chngpwd.confirmpassword.focus();

60 return
false;
61 }

62 return
true;
63 }
64 </script>
65   <style>
66         .errorWrap {
67     padding: 10px;
68     margin:
0 0 20px 0;
69     background: #fff;
70     border-left: 4px solid #dd3d36;
71     -webkit-box-shadow:
0 1px 1px 0 rgba(0,0,0,.1);
72     box-shadow:
0 1px 1px 0 rgba(0,0,0,.1);
73 }
74 .succWrap{
75     padding: 10px;
76     margin:
0 0 20px 0;
77     background: #fff;
78     border-left: 4px solid #5cb85c;
79     -webkit-box-shadow:
0 1px 1px 0 rgba(0,0,0,.1);
80     box-shadow:
0 1px 1px 0 rgba(0,0,0,.1);
81 }
82         </style>
83
84 </head>
85 <body>
86    <div
class="page-container">
87    <!--/content-inner-->
88 <div
class="left-content">
89        <div
class="mother-grid-inner">
90               <!--header start here-->
91 <?php include(
'includes/header.php');?>
92                             
93                      <div
class="clearfix"> </div>
94                 </div>
95 <!--heder end here-->
96     <ol
class="breadcrumb">
97                 <li
class="breadcrumb-item"><a href="dashboard.php">Home</a><i class="fa fa-angle-right"></i>Profile <i class="fa fa-angle-right"></i> Change Password</li>
98             </ol>
99         <!--grid-->
100     <div
class="grid-form">
101
102   <div
class="grid-form1">
103
104                   <?php
if($error){?><div class="errorWrap"><strong>ERROR</strong>:<?php echo htmlentities($error); ?> </div><?php }
105                 
else if($msg){?><div class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php }?>
106                 
107   <div
class="panel-body">
108                     <form name=
"chngpwd" method="post" class="form-horizontal" onSubmit="return valid();">
109
110                         <div
class="form-group">
111                             <label
class="col-md-2 control-label">Current Password</label>
112                             <div
class="col-md-8">
113                                 <div
class="input-group">
114                                     <span
class="input-group-addon">
115                                         <i
class="fa fa-key"></i>
116                                     </span>
117                                     <input type=
"password" name="password" class="form-control1" id="exampleInputPassword1" placeholder="Current Password" required="">
118                                 </div>
119                             </div>
120                         </div>
121
122     <div
class="form-group">
123                             <label
class="col-md-2 control-label">New Password</label>
124                             <div
class="col-md-8">
125                                 <div
class="input-group">
126                                     <span
class="input-group-addon">
127                                         <i
class="fa fa-key"></i>
128                                     </span>
129                                     <input type=
"password" class="form-control1" name="newpassword" id="newpassword" placeholder="New Password" required="">
130                                 </div>
131                             </div>
132                         </div>
133
134     <div
class="form-group">
135                             <label
class="col-md-2 control-label">Confirm Password</label>
136                             <div
class="col-md-8">
137                                 <div
class="input-group">
138                                     <span
class="input-group-addon">
139                                         <i
class="fa fa-key"></i>
140                                     </span>
141                                     <input type=
"password" class="form-control1" name="confirmpassword" id="confirmpassword" placeholder="Confrim Password" required="">
142                                 </div>
143                             </div>
144                         </div>
145
146                         <div
class="col-sm-8 col-sm-offset-2">
147                 <button type=
"submit" name="submit" class="btn-primary btn">Submit</button>
148                 <button type=
"reset" class="btn-inverse btn">Reset</button>
149             </div>
150         </div>
151             
152                     </form>
153     </div>
154 </div>
155 </div>
156 </div>
157     <!--
//grid-->
158
159 <!-- script-
for sticky-nav -->
160         <script>
161         $(document).ready(function() {
162              
var navoffeset=$(".header-main").offset().top;
163              $(window).scroll(function(){
164                 
var scrollpos=$(window).scrollTop();
165                 
if(scrollpos >=navoffeset){
166                     $(
".header-main").addClass("fixed");
167                 }
else{
168                     $(
".header-main").removeClass("fixed");
169                 }
170              });
171              
172         });
173         </script>
174         <!-- /script-
for sticky-nav -->
175 <!--inner block start here-->
176 <div
class="inner-block">
177
178 </div>
179 <!--inner block end here-->
180 <!--copy rights start here-->
181 <?php include(
'includes/footer.php');?>
182 <!--COPY rights end here-->
183 </div>
184 </div>
185   <!--
//content-inner-->
186         <!--/sidebar-menu-->
187                 <?php include(
'includes/sidebarmenu.php');?>
188                               <div
class="clearfix"></div>
189                             </div>
190                             <script>
191                             
var toggle = true;
192                                         
193                             $(
".sidebar-icon").click(function() {
194                               
if (toggle)
195                               {
196                                 $(
".page-container").addClass("sidebar-collapsed").removeClass("sidebar-collapsed-back");
197                                 $(
"#menu span").css({"position":"absolute"});
198                               }
199                               
else
200                               {
201                                 $(
".page-container").removeClass("sidebar-collapsed").addClass("sidebar-collapsed-back");
202                                 setTimeout(function() {
203                                   $(
"#menu span").css({"position":"relative"});
204                                 },
400);
205                               }
206                                             
207                                             toggle = !toggle;
208                                         });
209                             </script>
210 <script src=
"js/jquery.nicescroll.js"></script>
211 <script src=
"js/scripts.js"></script>
212 <script src=
"js/bootstrap.min.js"></script>
213    
214 </body>
215 </html>
216 <?php } ?>


Gõ tìm kiếm nhanh...